class ApiModel {
    constructor() {
        this.selectedAPIs = new Map();
        this.apiReasons = this.getApiReasons();
    }

    addAPI(apiId, reasons) {
        this.selectedAPIs.set(apiId, reasons);
    }

    removeAPI(apiId) {
        this.selectedAPIs.delete(apiId);
    }

    getSelectedAPIs() {
        return Array.from(this.selectedAPIs.entries()).map(([apiId, reasons]) => ({
            id: apiId,
            key: this.apiReasons[apiId].key,
            reasons: reasons
        }));
    }

    getApiReasons() {
        return {
            'file-timestamp': {
                key: 'NSFileTimestampUsageDescription',
                name: '文件时间戳 APIs',
                description: '访问文件的时间戳信息',
                reasons: [
                    {
                        code: 'DDA9.1',
                        en: 'Display file timestamps to the person using the device',
                        zh: '向设备用户显示文件时间戳',
                        note: '通过此原因访问的信息或任何衍生信息不得发送至设备外部'
                    },
                    // ... 其他原因
                ]
            },
            // ... 其他 API 类别
        };
    }
}

export default ApiModel; 